var path = require('path');
module.exports = {
    // 入口
    entry : {
        index : __dirname+'/src/maincss.js'
    },
    // 输出
    output: {
        path: __dirname+'/dist',
        filename: '[name].js'
    },
    // 监听文件编号自动编译
    watch : true,
    // 开发环境配置 //安装webpack-dev-server,package.json中添加运行命令 webpack-dev-server
    devServer : {
        contentBase : path.join(__dirname,'dist'),
        port : '8081'
    },
    // 解析模块规则
    module:{
        rules: [
            { test: /\.css$/, use : ['style-loader','css-loader'] },
            {test : /\.scss$/, use: ['style-loader','css-loader','sass-loader']},
            {test : /\.styl$/, use: ['style-loader','css-loader','stylus-loader']},

            {
                test: /\.(jpg|png|gif)$/,
                // use:['file-loader']
                use:['url-loader']
            }
        ]
    }
};
